package com.dragon.task.service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dragon.task.dao.AcTaskLoanIdMapper;
import com.dragon.task.entity.AcTaskLoanId;

@Service
public class AcTaskLoanIdServiceImpl implements AcTaskLoanIdDragonService {

	@Autowired 
	private AcTaskLoanIdMapper acTaskLoanIdMapper;
	
	@Override
	public List<String> selectLoanIdsByTaskType(String taskType, String claimNumber) {
		/*Map<String, Object> paramMap = new HashMap<>();
		paramMap.put("taskType", taskType);
		paramMap.put("claimNumber", claimNumber);
		acTaskLoanIdMapper.updateClaimNumber(paramMap);
		return acTaskLoanIdMapper.selectLoanIdsByTaskType(paramMap);*/
		return null;
	}

	@Override
	public void save(AcTaskLoanId acTaskLoanId) {
		acTaskLoanIdMapper.insertSelective(acTaskLoanId);
	}

	@Override
	public int updateByPrimaryKeySelective(AcTaskLoanId record) {
		return acTaskLoanIdMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public void deleteByLoanId(String loanId) {
		acTaskLoanIdMapper.deleteByLoanId(loanId);
	}

	@Override
	public List<String> selectLoanIdByTimeout(Integer timeOutHour) {
		return acTaskLoanIdMapper.selectLoanIdByTimeout(timeOutHour);
	}

	@Override
	public void cancelClaim(Date timeOutDate) {
		acTaskLoanIdMapper.cancelClaim(timeOutDate);
	}

	@Override
	public List<String> selectLoanIdsByTaskTypeNew(String taskType) {
		return acTaskLoanIdMapper.selectLoanIdsByTaskTypeNew(taskType);
	}

	@Override
	public List<String> selectLoanIdsByTaskTypeNew(String taskType, String claimNumber) {
		Map<String, Object> paramMap = new HashMap<>();
		paramMap.put("taskType", taskType);
		paramMap.put("claimNumber", claimNumber);
		acTaskLoanIdMapper.updateClaimNumber(paramMap);
		return acTaskLoanIdMapper.selectLoanIdsByTaskType(paramMap);
	}

}
